package com.game.modular.game.battle.process.skillEffectHandle.impl;

import com.game.modular.game.battle.panel.skillEffect.PvpSkillEffectServiceImpl;
import com.game.modular.game.battle.process.skillEffectHandle.base.BaseSkillEffectStrategy;
import com.game.modular.game.battle.panel.skillEffect.PvpSkillEffect;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

public class EffectCategory {
    @Component
    public static class BaseEffectCategory extends BaseSkillEffectStrategy {
        @Resource
        public PvpSkillEffectServiceImpl pvpSkillEffectService;

        @Override
        public PvpSkillEffect applyEffect(PvpSkillEffect pvpSkillEffect) {
            return pvpSkillEffect;
        }
    }

    // 47	净化	移除有害效果，包括控制技能（混乱，缴械，技穷，暴走，挑衅）dot伤害（溃逃，燃烧，妖术，恐慌）			[23,24,25,26,54,28,29,30,31]	10
    @Component
    public static class Effect_47 extends BaseEffectCategory {
        @Override
        public PvpSkillEffect applyEffect(PvpSkillEffect pvpSkillEffect) {
            // if (pvpSkillEffect.getStatus().getIsTriggers() == 1) {
            //     pvpSkillEffect.getImmunityList()
            //             .forEach(coreSkillEffectTypeId -> pvpSkillEffectService.remove(pvpSkillEffect.getBattleId(), pvpSkillEffect.getTargetPlayerHeroId(), coreSkillEffectTypeId));
            // }
            return super.applyEffect(pvpSkillEffect);
        }
    }

    // 63	跳过1回合准备	部分主动战法需要准备回合，这个可以跳过1回合的准备				10
    @Component
    public static class Effect_63 extends BaseEffectCategory {
        @Override
        public PvpSkillEffect applyEffect(PvpSkillEffect pvpSkillEffect) {
            // @todo 待实现

            // PvpSkillEffect select = PvpSkillEffect.builder()
            //         .battleId(pvpSkillEffect.getBattleId())
            //         .targetPlayerHeroId(pvpSkillEffect.getTargetPlayerHeroId())
            //         .build();
            // List<PvpSkillEffect> pvpSkillEffects = pvpSkillEffectService.eqList(select);
            // Battle battle = Battle.get(pvpSkillEffect.getBattleId());
            // Integer round = battle.getRound();
            // pvpSkillEffects.stream().forEach(item->{
            //     List<Integer> numberOfEffectiveRounds = item.getNumberOfEffectiveRounds();
            //     Integer i = numberOfEffectiveRounds.stream().min(Integer::compareTo).orElseThrow(() -> new NoSuchElementException("No value present"));
            //     if (i>round){
            //         List<Integer> collect = numberOfEffectiveRounds.stream().map(item1 -> item1 - 1).collect(Collectors.toList());
            //         item.setNumberOfEffectiveRounds(collect);
            //         SkillEffectTriggerHandle.applyEffect(item);
            //     }
            // });
            return super.applyEffect(pvpSkillEffect);
        }
    }

}
